home *** CD-ROM | disk | FTP | other *** search
- ;OCL{{{}}}
- ;OCL{{{ comments
- ; Same as goto-line, but does only open folds on the way to the line and not
- ; close all other folds. The line-argument must be in OCL-variable
- ; go-line-arg. The macro isn't to fast on long linear texts.
- ;OCL}}}
- @if-using not(ocl-file-go-line)
- @use (ocl-file-go-line)
- ;OCL{{{ libs
- @if-using not(ocl-file-error) @lib error @fi
- @if-using not(ocl-file-mt-fold) @lib mt-fold @fi
- ;OCL}}}
- ;OCL{{{ vars
- ( defvar
- ( go-line-arg ; input: linenumber
- go-line-x ; help-counter
- )
- )
- ;OCL}}}
- ;OCL{{{ go-line
- ( deffun go-line
- ( if in-prompt ( return-from-macro ) fi
- local
- ( go-line-x go-line-arg )
- ( screen-off
- while
- pre
- ( set go-line-x -(go-line-arg store-line) )
- <>(go-line-x 0)
- ;OCL{{{ one step to correct line
- ( if >(go-line-x 0)
- ;OCL{{{ down
- ( if test-bottom
- ( @if-using not(NO-SCR-OFF) screen-on redraw-display @fi
- return-from-macro
- )
- fi
- next-line
- @if-using not(NO-SCR-OFF)
- if >(go-line-x 100)
- ( if >(go-line-x 200)
- ( set go-line-x 100 )
- else
- ( set go-line-x 20 )
- fi
- do
- ( next-line
- set go-line-x -(go-line-x 1)
- )
- while >(go-line-x 0)
- )
- fi
- @fi
- )
- ;OCL}}}
- else
- ;OCL{{{ up
- ( if test-top ( return-from-macro ) fi
- previous-line
- ;OCL{{{ on fold?, maybe down again
- if or(test-fold-line,test-filed)
- ( set go-line-x -(go-line-arg store-line)
- if =(go-line-x 0)
- ( @if-using not(NO-SCR-OFF) screen-on redraw-display @fi
- return-from-macro
- )
- fi
- ;OCL{{{ maybe skip to end of this fold
- if >(go-line-x 0)
- ( if test-filed
- ( @if-using not(NO-SCR-OFF) screen-on redraw-display @fi
- return-from-macro
- )
- fi
- open-fold
- mtool-bot
- )
- fi
- ;OCL}}}
- )
- fi
- ;OCL}}}
- )
- ;OCL}}}
- fi
- )
- ;OCL}}}
- screen-on
- redraw-display
- )
- )
- )
- ;OCL}}}
- ;OCL{{{ undeclare
- ( undeclare ( go-line-x ) )
- ;OCL}}}
- @fi
-